PImage a,b;
int m = 16;
int z = 5 ;
int XX=100,YY=150;



a = loadImage("man1.png");
b = loadImage("man1.png");
int dim = b.width * b.height;
b.filter(GRAY);

size (200,200) ;
int i = 0 ;
int col = 1 ;
int row = 1 ;

int base_x = XX-20;
int base_y = YY-140;

int row_height=  15;
int col_width = 15;

background(255);

fill(255,0,0);
ellipse(XX,YY,5,5);



while (++i <= m) {
  print("row = " + row);
  println(" col = " + col);
  int x = base_x - (row - 1) * col_width + (col -1 ) * col_width*2;
  int y = base_y + ( row - 1 ) * row_height;
  if ( m -i  < z )  {
    image (a,x,y);
  } else {
    image (b,x,y);
  }
  col++ ; 
  if ( col > row ) {
    row ++ ;
    col = 1;
  }
  
}


/*
noTint();
image (a,0,0);
image (a,30,0);
tint(255,128);
image (a,60,0);
*/ 
